package com.asset.dispoal.business.repayment;

import com.asset.dispoal.business.casedispose.dto.CaseDisposePageResponse;
import com.asset.dispoal.business.repayment.api.RepaymentService;
import com.asset.dispoal.business.repayment.dto.RepaymentInfoResponse;
import com.asset.dispoal.business.repayment.dto.RepaymentRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.mhuang.pacebox.springboot.protocol.Result;
import tech.mhuang.pacebox.springboot.protocol.data.PageVO;

/**
 * @description: 还款管理
 * @author: yf
 * @date: 2022-09-26 14:19:36
 */
@RestController
@RequestMapping("business/repayment")
@Api(value = "还款管理", tags = "还款管理")
public class RepaymentController {

    @Autowired
    private RepaymentService repaymentService;

    @PostMapping("/queryPage")
    @ApiOperation(value = "还款列表分页查询接口", notes = "还款列表分页查询")
    public Result<PageVO<CaseDisposePageResponse>> queryPage(@RequestBody RepaymentRequest request) {
        return repaymentService.queryPage(request);
    }

    @GetMapping("/getRepaymentInfo")
    @ApiOperation(value = "获取还款信息接口", notes = "获取还款信息接口")
    public Result<RepaymentInfoResponse> getRepaymentInfo(String caseId) {
        return repaymentService.getRepayInfoByCaseId(caseId);
    }

    @GetMapping("/getPenaltyInterestByFormular")
    @ApiOperation(value = "公式选择罚息计算接口", notes = "公式选择罚息计算接口")
    public Result getPenaltyInterestByFormular(@ApiParam("案件id") String caseId,
                                               @ApiParam("罚息规则规则id") String batchParameterId) {

        return repaymentService.getPenaltyInterestByFormular(caseId, batchParameterId);
    }


}
